<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="__CSS__/layui.css">
    <link rel="stylesheet" href="__CSS__/view.css"/>
    <title></title>
</head>
<body class="layui-view-body">
<div class="layui-content">
    <div class="layui-row">
        <div class="layui-card">
            <div class="layui-card-header">修改信息</div>
            <form class="layui-form layui-card-body" name="form" action="" method="post">
                <input type="hidden" name="agid" value="{$userinfo['user_id']}">
                <div class="layui-form-item">
                    <label class="layui-form-label">用户名</label>
                    <div class="layui-input-block">
                        <input type="text" disabled="disabled" value="{$userinfo['user_account']}" placeholder="请输入用户名"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">姓名</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" required lay-verify="required" value="{$userinfo['user_name']}"
                               placeholder="请输入姓名" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手机号</label>
                    <div class="layui-input-block">
                        <input type="number" name="phone" id="phone" required lay-verify="required"
                               value="{$userinfo['user_phone']}" placeholder="请输入手机号" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">身份证</label>
                    <div class="layui-input-block">
                        <input type="text" name="idcard" id="idcard" required lay-verify="required"
                               value="{$userinfo['user_idcard']}" placeholder="请输入身份证" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">选择修改的代理等级</label>
                    <div class="layui-input-block">
                        <select name="grade_id" lay-verify="required">
                            <option value=""></option>
                            {volist name="typeList" id="va"}
                            <option value="{$va.type_id}" {$userinfo.user_type_id== $va.type_id ?
                            'selected' : ''}>{$va.type_name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">还款费率%</label>
                    <div class="layui-input-block">
                        <input type="number" disabled="disabled"  value="{$rate['1']['rate_rate']*100}" placeholder="请输入签署费率" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">收款费率%</label>
                    <div class="layui-input-block">
                        <input type="number" disabled="disabled" value="{$rate['2']['rate_rate']*100}" placeholder="请输入签署费率" autocomplete="off" class="layui-input">
                    </div>
                </div>


                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <span class="layui-btn layui-btn-blue" lay-submit lay-filter="formDemo"
                              onclick="sub()">立即提交</span>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="__JS__/layui.all.js"></script>
<script src="__JS__/layer/layer.js"></script>
<script src="__JS__/jquery.min.js"></script>
<script>
    var form = layui.form
        , layer = layui.layer;
</script>
</body>
<script>
    function sub() {
        var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
        if (myreg.test($("#phone").val()) === false) {
            layer.msg('请输入正确的手机号');
            return false;
        }
        var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
        if (reg.test($("#idcard").val()) === false) {
            layer.msg('请输入正确的身份证');
            return false;
        }
        $.post("{:Url('member/user/upagent')}", $("form").serialize(), function (data) {
            if (data.error == 0) {
                layer.msg(data.msg, {time: 2000}, function () {
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
                })
            } else {
                layer.msg(data.msg);
            }
        })
    }
</script>
</html>